package ooday04;

import java.util.concurrent.Callable;

public class Test {
    public static void main(String[] args) {
        Animal[] animal=new Animal[3];
        animal[0] =new Dog("大黄",3,"白");
        animal[1] =new Fish("大白",3,"白");
        animal[2] =new Chick("大红",3,"白");
        for (int i=0;i<animal.length;i++){
            System.out.println(animal[i].name);
            animal[i].eat();
            animal[i].drink();
            if(animal[i] instanceof Dog){
               Dog dog=(Dog)animal[i];
               dog.lookHome();
            }
            if (animal[i] instanceof Chick){
               Chick chick=(Chick)animal[i];
               chick.layEggs();


            }
            if(animal[i] instanceof Swim){
                Swim swim=(Swim)animal[i];
                swim.swim();
            }

        }
    }
}
